<script>
import AmountInput from '@/components/amountInput'
export default {
    props: {
        field: {
            required: true,
            default: null
        }
    },
    components: {
        AmountInput
    },
    computed:{
        attrs(){
            const attrs = {...this.$attrs}

            if(this.field && this.field.fieldType === 'date'){
                attrs['value-format'] = 'yyyy-MM-dd'
            }

            return attrs
        },
        listeners(){
            const listeners = {...this.$listeners}

            return listeners
        }
    }
}
</script>

<template>
        <el-input v-if="field && field.fieldType === 'string'" v-on="listeners" v-bind="attrs" />
        <AmountInput v-else-if="field && field.fieldType === 'number'" v-on="listeners" v-bind="attrs"  />
        <el-date-picker v-else-if="field && field.fieldType === 'date'" type="date" v-on="listeners" v-bind="attrs" />
</template>

<style lang="scss"></style>